﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Mail;
using System.Net;
using System.Net.Mime;
using System.Threading;
using System.ComponentModel;

namespace nrtech.bot.compras.bll
{
    public class mailSender
    {
        public static void sender(String body, String subject)
        {
            Constants.senderMail = new MailMessage();
            Constants.smtpClient = new SmtpClient();

            Constants.senderMail.IsBodyHtml = true;
            Constants.senderMail.From = new MailAddress(Config.email);
            Constants.senderMail.To.Add(Config.email);
            Constants.senderMail.Subject = subject;
            Constants.senderMail.Body = body;

            Constants.smtpClient.Host = Config.smtp;
            Constants.smtpClient.Port = Config.porta;
            Constants.smtpClient.EnableSsl = Config.ssl;
            Constants.smtpClient.Credentials = new NetworkCredential(Config.userMail, Config.passMail);
            
            Constants.smtpClient.Send(Constants.senderMail);
        }
    }
}
